#ifndef PUDGE_UI_PANE_HPP
#define PUDGE_UI_PANE_HPP

#include <pudge/meta/lazy.hpp>
#include <pudge/ui/widget.hpp>

namespace pudge { namespace ui {

	template<class Traits> struct pane : widget<Traits>
	{
		typedef std::vector<widget<Traits>*> widget_list;

		widget_list widgets_;
		widget_list & widgets() { return widgets_; }
	};

	struct tick_pane_
	{
		template<class C, class F, class P> struct result { typedef void type; };

		template<class Context, class Frame, class Pane>
		void operator()(Context & c, Frame & f, Pane & p) const
		{
			typedef Pane::widget_list List;
			
			Frame fc = f;

			List & l = p.widgets();
			for(List::iterator i = l.begin(); i != l.end(); ++i)
				(**i)(c,fc);
		}
	};
	
	pudge::meta::lazy<tick_pane_> const tick_pane = tick_pane_();
}}

#endif